Page({
  data: {
    getQualityListAll: [],
    getQualityListAllIndex: {},
    qualityIndex:0,
    path:'',
    file:{},
    id:0,
    districtId:0
  },
  onLoad(options){
    this.getQualityListAll();
    this.setData({
      id:options.id,
      districtId:options.districtId
    })
  },
  bindQualityChange: function(e) {
    this.setData({
      qualityIndex: e.detail.value
    })
  },
  getQualityListAll(){
    wx.request({
      url: 'http://139.9.169.87:9002/getUserListAll',
      success:({data:res})=>{
        let getQualityListAll=[];
        let newObjArry=[];
        res.data.forEach(item=>{
          getQualityListAll.push(item.username)
          newObjArry.push({
            id:item.id,
            name:item.username
          })
        })
        this.setData({
          getQualityListAll,
          getQualityListAllIndex:newObjArry,
          getPartsListAllIndex:newObjArry
        });
      }
    })
  },
  getList(e){
    var qualityId=this.data.getQualityListAllIndex[this.data.qualityIndex].id
    wx.request({
      url: 'http://139.9.169.87:9002/app/Event/transferOrder',
      data:{
        districtId:1,
        id:this.data.id,
        userId:qualityId
      },
      success:({data:res})=>{
        if(res.status==200){
          wx.showModal({
            content:'转单成功！',
            showCancel:false,
            success:()=>{
              wx.redirectTo({
                url: '/pages/event/event',
              })
            }
          })
        }
      }
    })
  }
})